﻿using Microsoft.Extensions.Hosting;
using ConsoleGenericHostDemo;
using Microsoft.Extensions.DependencyInjection;

var host = Host.CreateDefaultBuilder(args)
    .ConfigureServices((hostContext, services) =>
    {
        services.AddTransient<IOrderService, OrderService>();
    })
    .Build();

// host.Run();

using (var serviceScope = host.Services.CreateScope())
{
    var services = serviceScope.ServiceProvider;
    var orderService = services.GetRequiredService<IOrderService>();
    orderService.AutoCancel();
}